package cn.kgm.abstractFactory;

import cn.kgm.abstractFactory.color.Color;
import cn.kgm.abstractFactory.shape.Circle;
import cn.kgm.abstractFactory.shape.Rectangle;
import cn.kgm.abstractFactory.shape.Shape;
import cn.kgm.abstractFactory.shape.Square;
import cn.kgm.enums.ShapeEnums;

public class ShapeFactory extends AbstractFactory {

    @Override
    public Shape getShape(String type) {
        Shape shape = null;
        try {
            switch (ShapeEnums.getByType(type)) {
                case CIRCLE:
                    shape = new Circle();
                    break;
                case RECTANGLE:
                    shape = new Rectangle();
                    break;
                case SQUARE:
                    shape = new Square();
                    break;
                default:
                    return shape;
            }
            return shape;
        } catch (RuntimeException e) {
            e.printStackTrace();
        }
        return null;
    }

    @Override
    public Color getColor(String color) {
        return null;
    }
}
